home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / MacPerl 506 appl folder.sit / MacPerl 506 appl folder / Mac_Perl_506r1m_appl / lib / hostname.pl < prev    next >
Text File  |  1995-03-20  |  514b  |  27 lines

  1. # From: asherman@fmrco.com (Aaron Sherman)
  2.  
  3. sub hostname
  4. {
  5. #    local(*P,@tmp,$hostname,$_);
  6. #    if (open(P,"hostname 2>&1 |") && (@tmp = <P>) && close(P))
  7. #    {
  8. #        chop($hostname = $tmp[$#tmp]);
  9. #    }
  10. #    elsif (open(P,"uname -n 2>&1 |") && (@tmp = <P>) && close(P))
  11. #    {
  12. #        chop($hostname = $tmp[$#tmp]);
  13. #    }
  14. #    else
  15. #    {
  16. #        die "$0: Cannot get hostname from 'hostname' or 'uname -n'¥n";
  17. #    }
  18. #    @tmp = ();
  19. #    close P; # Just in case we failed in an odd spot....
  20. #    $hostname;
  21.  
  22.     chop($hostname = `hostname`);
  23.     $hostname;
  24. }
  25.  
  26. 1;
  27.